package ro.thich.alchemy;

import android.content.*;
import android.view.*;
import android.widget.*;
import java.util.*;
import ro.thich.alchemy.*;
import java.util.List;

public class ListAdapter extends ArrayAdapter
 {

	// List context
    private final Context context;
    // List values
    private final List elementList;

	public ListAdapter(Context context, List elementList) {
		super(context, R.layout.element, elementList);
		this.context = context;
		this.elementList = elementList;
		
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

		View rowView = inflater.inflate(R.layout.element, parent, false);
		Element todo = (Element)this.getItem(position);
		TextView elementText = (TextView) rowView.findViewById(R.id.elementText);
		elementText.setText(todo.getText());
		return rowView;
	}
} 
